 {
        

        var o = require("../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                labTips: {
                    default: null,
                    type: cc.Label
                },
                spNotice: {
                    default: null,
                    type: cc.Sprite
                },
                nodeItem: {
                    default: null,
                    type: cc.Node
                },
                spHuanPai: {
                    default: null,
                    type: cc.Sprite
                }
            },
            onLoad: function () {
                this._selectData = {}, Global.tableModel.setSelectHuanPaiColor(null), this.labTips && (this.labTips.node.active = !1),
                    Global.notificationCenter.on(Global.eventName.GAME_HUANPAI_SELECT, this._onHuanPaiSelect.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_HUANPAI_UNSELECT_ALL, this._onHuanPaiUnSelectAll.bind(this), this);
                var e = null;
                3 == Global.tableModel.getChangeTileCount() ? e = "ZT_nr1" : 4 == Global.tableModel.getChangeTileCount() && (e = "ZT_nr1_1"),
                null != e && Global.spriteAtlas.setSpriteFrame(this.spNotice, "Texture/table", e);
            },
            start: function () {
            },
            onDestroy: function () {
                Global.notificationCenter.offAll(this);
            },
            _onHuanPaiSelect: function (e) {
                for (var t in cc.log("_onHuanPaiSelect data:", JSON.stringify(e)), this._selectData) {
                    var n = this._selectData[t];
                    if (null != n && n.tileIndex == e.tileIndex) {
                        var o = n.tileIndex;
                        delete this._selectData[o], Global.tableModel.setSelectHuanPaiColor(this._selectData),
                            Global.notificationCenter.emit(Global.eventName.GAME_UNSELECT_TILE, o);
                    }
                }
                1 == e.isSelect && (this._selectData[e.tileIndex] = e, Global.tableModel.setSelectHuanPaiColor(this._selectData));
            },
            _onHuanPaiUnSelectAll: function () {
                this._selectData = {}, Global.tableModel.setSelectHuanPaiColor(null);
            },
            onClickHuanPai: function () {
                o.playEffect("select");
                var e = [];
                for (var t in this._selectData) {
                    var n = this._selectData[t];
                    if (e.push(n.tileValue), n.tileValue <= 0) return this._selectData = {}, Global.tableModel.setSelectHuanPaiColor(null),
                        Global.notificationCenter.emit(Global.eventName.GAME_HUANPAI_UNSELECT_ALL), void Global.notificationCenter.emit(Global.eventName.GAME_SHOW_COMMTIPS, "请重新选择!");
                }
                if (e.length != Global.tableModel.getChangeTileCount()) return cc.error("NodeHuanPaiController onClickHuanPai", "tiles.length = " + e.length + " ChangeTileCount = " + Global.tableModel.getChangeTileCount()),
                    Global.notificationCenter.emit(Global.eventName.GAME_HUANPAI_UNSELECT_ALL), void Global.utils.showNodeCommon("请选择" + Global.tableModel.getChangeTileCount() + "张同色牌", 1);
                var i = Global.tableModel.getRoomId(), a = Global.tableModel.getTableId(),
                    r = Global.tableModel.getSeatId();
                if (0 != i && 0 != a) {
                    if (Global.msgHandler.requestHuanPai(i, a, r, e), this._selectData = {}, Global.tableModel.setSelectHuanPaiColor(null),
                    this.labTips && (this.labTips.node.active = !0), this.nodeItem && (this.nodeItem.active = !1),
                        this.spHuanPai) {
                        var s = "TH_down";
                        4 == Global.tableModel.getChangeTileCount() && (s = "TH_down2"), Global.spriteAtlas.setSpriteFrame(this.spHuanPai, "Texture/table", s);
                    }
                    var l = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                    l && l.delTiles(e), Global.notificationCenter.emit(Global.eventName.GAME_HUANPAI_SELECT_END),
                        Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_STAND_TILE);
                } else cc.error("NodeHuanPaiController onClickHuanPai", "roomId = " + i + " tableId = " + a + " seatId = " + r);
            }
        })
    }